/*
* Author: Dzlua
* QQ    : 505544956
* time  : 2017/08/11
*/

#include <dzlua.h>
#include <iostream>

int main(int argc, char* argv[])
{
    std::future<int> result1;
    std::future<int> result2;

    std::cout << "main thread id : " << std::this_thread::get_id() << std::endl;

    result1 = dzlua::CallAfter::SyncCall(std::chrono::milliseconds(1000), [](int a, int b) -> int {
        std::cout << "SyncCall thread id : " << std::this_thread::get_id() << std::endl;
        return a + b;
    }, 1, 1);

    result2 = dzlua::CallAfter::AsyncCall(std::chrono::seconds(3), [](int a, int b) -> int {
        std::cout << "AsyncCall thread id : " << std::this_thread::get_id() << std::endl;
        return a + b;
    }, 2, 2);

    std::cout << "resault1 : " << result1.get() << std::endl;
    std::cout << "resault2 : " << result2.get() << std::endl;
    
    return 0;
}